/*! lzf */

if (jQuery.fn.pagination = function (t, u) {
    return u = jQuery.extend({
        items_per_page: 10,
        num_display_entries: 10,
        current_page: 0,
        link_to: "#",
        prev_text: "Prev",
        next_text: "Next",
        ellipse_text: "...",
        prev_show_always: !0,
        next_show_always: !0,
        callback: function () {
            return !1
        }
    }, u || {}), this.each(function () {
        function s() {
            return Math.ceil(t / u.items_per_page)
        }

        function l(t, e) {
            p = t, n();
            var a = u.callback(t, c);
            return a || (e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0), a
        }

        function n() {
            c.empty();
            var t, e, a,
                n = (t = Math.floor(u.num_display_entries / 2), e = s(), a = e - u.num_display_entries + 1, [t < p ? Math.max(Math.min(p - t, a), 1) : 1, t < p ? Math.min(p + t, e) : Math.min(u.num_display_entries, e)]),
                i = s(), o = function (t, e) {
                    if (t = t < 1 ? 1 : t < i ? t : i, e = jQuery.extend({
                        text: t,
                        classes: ""
                    }, e || {}), t == p) var a = jQuery("<span class='current'>" + e.text + "</span>"); else if (u.link_to && "#" != u.link_to) a = jQuery("<a>" + e.text + "</a>").attr("href", u.link_to.replace(/__id__/, t)); else a = jQuery("<a>" + e.text + "</a>").bind("click", (n = t, function (t) {
                        return l(n, t)
                    })).attr("href", "#");
                    var n;
                    e.classes && a.addClass(e.classes), c.append(a)
                };
            o(1, {
                text: "首页",
                classes: "last"
            }), u.prev_text && (1 < p || u.prev_show_always) && o(p - 1, {text: u.prev_text, classes: "prev"});
            for (var r = n[0]; r <= n[1]; r++) o(r);
            u.next_text && (p < i || u.next_show_always) && o(p + 1, {
                text: u.next_text,
                classes: "next"
            }), o(i, {text: "末页", classes: "last"})
        }

        var p = parseInt(u.current_page);
        t = !t || t < 1 ? 1 : t, u.items_per_page = !u.items_per_page || u.items_per_page < 1 ? 1 : u.items_per_page;
        var c = jQuery(this);
        this.selectPage = function (t) {
            l(t)
        }, this.prevPage = function () {
            return 1 < p && (l(p - 1), !0)
        }, this.nextPage = function () {
            return p < s() && (l(p + 1), !0)
        }, n(), u.callback(p, this)
    })
}, 0 < $("#float").length) {
    var float_obj = $("#float"), offsetTop = float_obj.offset().top;
    window.onscroll = function () {
        offsetTop < $(document).scrollTop() ? (float_obj.css("position", "fixed"), float_obj.css("top", "0px")) : float_obj.css("position", "relative")
    }
}

function Event(t) {
    var a = [];
    this.getName = function () {
        return t
    }, this.addHandler = function (t) {
        a.push(t)
    }, this.removeHandler = function (t) {
        for (var e = 0; e < a.length; e++) if (a[e] == t) {
            a.splice(e, 1);
            break
        }
    }, this.fire = function (e) {
        a.forEach(function (t) {
            t(e)
        })
    }
}

function EventAggregator() {
    var n = [];

    function i(e) {
        return $.grep(n, function (t) {
            return t.getName() === e
        })[0]
    }

    this.publish = function (t, e) {
        var a = i(t);
        a || (a = new Event(t), n.push(a)), a.fire(e)
    }, this.subscribe = function (t, e) {
        var a = i(t);
        a || (a = new Event(t), n.push(a)), a.addHandler(e)
    }
}

function BuildingListController(t, e) {
    var a = t.getTarget();
    e.subscribe("labelClick", function (t) {
        var e = $("#poi" + t.point.index).offset().top;
        $("html,body").animate({scrollTop: e})
    }), a.mouseover(function () {
        e.publish("buildingListMouseOver", {index: $(this).attr("data-num")})
    }).mouseout(function () {
        e.publish("buildingListMouseOut", {index: $(this).attr("data-num")})
    })
}

function MapRepository() {
    var e, a = [], t = $(".building-item");
    t.each(function (t) {
        e = {lng: $(this).attr("lng"), lat: $(this).attr("lat"), index: t + 1}, a.push(e)
    }), this.getPoints = function () {
        return a
    }, this.getTarget = function () {
        return t
    }
}

function MapController(t, e) {
    var a, n, i, o, r, s = t.getPoints(), l = [], p = [];

    function c() {
        var t = $(this).attr("data-num") - 1;
        e.publish("labelClick", {point: s[t]})
    }

    0 !== s.length && (e.subscribe("buildingListMouseOver", function (t) {
        $(p[t.index - 1]).addClass("map-active-mark" + t.index)
    }), e.subscribe("buildingListMouseOut", function (t) {
        $(p[t.index - 1]).removeClass("map-active-mark" + t.index)
    }), (o = new BMap.Map("right_map", {enableMapClick: !1})).addControl(new BMap.NavigationControl({type: BMAP_NAVIGATION_CONTROL_ZOOM})), o.disableScrollWheelZoom(), o.disableInertialDragging(!0), s.forEach(function (t) {
        a = new BMap.Point(t.lng, t.lat), n = {
            point: a,
            className: "map-mark" + t.index,
            offsetX: "10.5",
            offsetY: "33",
            num: t.index
        }, i = new MyLabel(n), o.addOverlay(i), i._div.onclick = c, l.push(a), p.push(i._div)
    }), r = o.getViewport(l, {enableAnimation: !0, margins: [10, 10, 10, 10]}), o.centerAndZoom(r.center, r.zoom))
}

function PropertyOverlay(t, e, a) {
    this._point = t, this._text = e, this._overText = a
}

function StationOverlay(t, e) {
    var a = new BMap.Point(t.lng, t.lat);
    this._point = a, this._text = t.name, this._overText = t.num + "套", this._lng = t.lng, this._lat = t.lat, this._class = e
}

function CityOverlay(t, e, a, n, i) {
    this._point = t, this._text = e, this._overText = a, this._lng = n, this._lat = i
}

function AreaOverlay(t, e, a, n, i) {
    this._point = t, this._text = e, this._overText = a, this._lng = n, this._lat = i
}

function MyLabel(t) {
    this._point = t.point, this._className = t.className, this._offsetX = t.offsetX, this._offsetY = t.offsetY, this._num = t.num
}

function ZoomControl() {
    this.defaultAnchor = BMAP_ANCHOR_BOTTOM_RIGHT, this.defaultOffset = new BMap.Size(10, 77)
}

function ZoomControl2() {
    this.defaultAnchor = BMAP_ANCHOR_BOTTOM_RIGHT, this.defaultOffset = new BMap.Size(10, 50)
}

function judge_drag_distance(t, e, a) {
    var n = ["0.0097", "0.009"], i = t.lng, o = t.lat, r = Number(e.lng), s = Number(e.lat), l = 4;
    switch (a) {
        case"city":
            return !1;
        case"area":
            l = 4;
            break;
        case"property":
            l = 1
    }
    return !(r - l * n[0] < i && i < r + l * n[0] && o < s + l * n[1] && s - l * n[1] < o)
}

function judge_apt_num(t, e) {
    var a = 0, n = t || e;
    if (n) for (var i = 0, o = n.length; i < o; i++) {
        var r = n[i].num;
        a += Number(r)
    }
    return a
}

PropertyOverlay.prototype = new BMap.Overlay, PropertyOverlay.prototype.initialize = function (t) {
    this._map = t;
    var e = this._div = document.createElement("div");
    e.className = "property-label";
    var a = this._span = document.createElement("span");
    e.appendChild(a), a.appendChild(document.createTextNode(this._text)), a.className = "property-label-con";
    var n = this._arrow = document.createElement("div");
    n.className = "property-label-arrow", e.appendChild(n);
    a = document.createElement("span");
    return e.appendChild(a), a.appendChild(document.createTextNode(this._overText)), a.className = "property-label-num", t.getPanes().labelPane.appendChild(e), e
}, PropertyOverlay.prototype.draw = function () {
    var t = this._map.pointToOverlayPixel(this._point);
    this._div.style.left = t.x - 10 + "px", this._div.style.top = t.y - 30 + "px"
}, StationOverlay.prototype = new BMap.Overlay, StationOverlay.prototype.initialize = function (t) {
    this._map = t;
    var e = this._div = document.createElement("div");
    e.className = this._class, (a = this._span = document.createElement("span")).style.paddingLeft = "6px", e.appendChild(a), a.appendChild(document.createTextNode(this._text));
    var a;
    (a = document.createElement("span")).className = "sites-num", e.appendChild(a), a.appendChild(document.createTextNode(this._overText));
    var n = this._arrow = document.createElement("div");
    return e.appendChild(n), n.className = "sites-arrow", e.setAttribute("lng", this._lng), e.setAttribute("lat", this._lat), t.getPanes().labelPane.appendChild(e), e
}, StationOverlay.prototype.draw = function () {
    var t = this._map.pointToOverlayPixel(this._point);
    this._div.style.left = t.x - 30 + "px", this._div.style.top = t.y - 34 + "px"
}, CityOverlay.prototype = new BMap.Overlay, CityOverlay.prototype.initialize = function (t) {
    this._map = t;
    var e = this._div = document.createElement("div");
    e.style.position = "absolute", e.style.zIndex = BMap.Overlay.getZIndex(this._point.lat), e.className = "city-label";
    var a = this._span = document.createElement("span");
    a.className = "city-label-con", e.appendChild(a), a.appendChild(document.createTextNode(this._overText)), a.appendChild(document.createElement("br")), a.appendChild(document.createTextNode(this._text));
    return e.setAttribute("lng", this._lng), e.setAttribute("lat", this._lat), t.getPanes().labelPane.appendChild(e), e
}, CityOverlay.prototype.draw = function () {
    var t = this._map.pointToOverlayPixel(this._point);
    this._div.style.left = t.x - 38 + "px", this._div.style.top = t.y - 38 + "px"
}, AreaOverlay.prototype = new BMap.Overlay, AreaOverlay.prototype.initialize = function (t) {
    this._map = t;
    var e = this._div = document.createElement("div");
    e.className = "area-label", (a = this._span = document.createElement("div")).className = "area-label-num", e.appendChild(a), a.appendChild(document.createTextNode(this._text));
    var a;
    return (a = document.createElement("span")).className = "area-label-con", e.appendChild(a), a.appendChild(document.createTextNode(this._overText)), e.setAttribute("lng", this._lng), e.setAttribute("lat", this._lat), t.getPanes().labelPane.appendChild(e), e
}, AreaOverlay.prototype.draw = function () {
    var t = this._map.pointToOverlayPixel(this._point);
    this._div.style.left = t.x - 40 + "px", this._div.style.top = t.y - 80 + "px"
}, MyLabel.prototype = new BMap.Overlay, MyLabel.prototype.initialize = function (t) {
    this._map = t;
    var e = this._div = document.createElement("div");
    return e.className = this._className, e.setAttribute("lng", this._point.lng), e.setAttribute("lat", this._point.lat), e.setAttribute("data-num", this._num), t.getPanes().labelPane.appendChild(e), e
}, MyLabel.prototype.draw = function () {
    var t = this._map.pointToOverlayPixel(this._point);
    this._div.style.left = t.x - this._offsetX + "px", this._div.style.top = t.y - this._offsetY + "px"
}, ZoomControl.prototype = new BMap.Control, ZoomControl.prototype.initialize = function (e) {
    var t = document.createElement("div");
    return t.className = "zoom-label zoom-in", t.title = "放大一级", t.onclick = function (t) {
        e.setZoom(e.getZoom() + 1)
    }, e.getContainer().appendChild(t), t
}, ZoomControl2.prototype = new BMap.Control, ZoomControl2.prototype.initialize = function (e) {
    var t = document.createElement("div");
    return t.className = "zoom-label zoom-out", t.title = "缩小一级", t.onclick = function (t) {
        e.setZoom(e.getZoom() - 1)
    }, e.getContainer().appendChild(t), t
}, $("#set_rent").click(function (t) {
    var e = $("#first_price").val(), a = $("#second_price").val(), n = window.location.pathname;
    if ("" !== e && "0" !== e || "" !== a && "0" !== a) {
        var i = {first_price: e, second_price: a, url: n};
        $.post(base.site_url("client/search/search/priceSearch"), i, function (t) {
            0 == t.code && (window.location.href = t.data)
        }, "json")
    }
}), $("#sku_apart_btn").click(function (t) {
    var e = [], a = window.location.pathname;
    $("#sku_apart").find("input[type=checkbox]:checked").each(function () {
        e.push($(this).val())
    });
    var n = {ids: e, url: a};
    $.post(base.site_url("client/search/search/setSkuCond"), n, function (t) {
        0 === t.code && (window.location.href = t.data)
    }, "json")
});